package edu.java.texbooks.scjp.threads.test09;

/**
 * 
 * SCJP book: The Thread class itself implements Runnable.
 * <p>
 * This means that you could pass a Thread to another Thread’s constructor.
 * </p>
 * 
 */
public class Test {
	public static void main(String[] args) {

		// Put thread in constructor of other thread
		// test();

		// test setName() method, isDeamon()
		testExtraNotes();

	}

	public static void test() {
		System.out.println("Current Thread Name: "
				+ Thread.currentThread().getName());

		MyThread mt = new MyThread("cecoThread");

		Thread t1 = new Thread(mt, "superThread");
		mt.start();

		// t1 calls the start() method of Thread class,
		// NOT the start() method of MyThread class
		t1.start();
	}

	/**
	 * test <code>setName()</code> method and <code>isDeamon()</code>
	 */
	public static void testExtraNotes() {
		// 

		MyThread thread = new MyThread("gencho");
		System.out.println("Current Thread Name: " + thread.getName());

		thread.setName("svircho");
		System.out.println("Current Thread Name: " + thread.getName());

		System.out.println(thread.getName() + " is deamon: "
				+ thread.isDaemon());

	}
}
